<!DOCTYPE html>
<html>
  <body>
    <h1>演示如何访问输入按钮</h1>
    <p>单击按钮可获取显示在按钮上的文本。</p>
    <input type="button" id="myBtn" onclick="myFunction()" value="试一试" />
    <p id="demo"></p>
    <script>
      function myFunction() {
        var x = document.getElementById("myBtn").value;
        var now_time = new Date();
        console.log(x+" " + now_time.toLocaleString())
        document.getElementById("demo").innerHTML = x+" " + now_time.toLocaleString();
      }
    </script>
  </body>
</html>
